<?php
namespace app\learn\controller;

use app\BaseController;
use think\facade\View;

class Bank extends BaseController
{
    protected function data()
    {
        $data = [
            ['id' => '6000', 'name' => '公司附件'],
            ['id' => '6001', 'name' => '内部通用凭证'],
            ['id' => '6002', 'name' => '业务收费凭证'],
            ['id' => '6017', 'name' => '电汇凭证第二联'],
            ['id' => '6082', 'name' => '电汇凭证第三联'],
            ['id' => '6089', 'name' => '预算拨款凭证'],
            ['id' => '6067', 'name' => '身份证复印件'],
            ['id' => '6501', 'name' => '单证购买申请书'],
            ['id' => '6068', 'name' => '转购支票'],
            ['id' => '6074', 'name' => '进账单-附件'],
            ['id' => '6069', 'name' => '现金支票'],
            ['id' => '6003', 'name' => '现金交款单'],
            ['id' => '6140', 'name' => '财政授权支付凭证'],
            ['id' => '6187', 'name' => '查复书'],
            ['id' => '6186', 'name' => '查询书'],
            ['id' => '6027', 'name' => '信息类报文接收专用凭证'],
            ['id' => '8048', 'name' => '单位定期（通知）存款证书第一联'],
            ['id' => '8228', 'name' => '单位定期（通知）存款证书第二联'],
            ['id' => '6149', 'name' => '社会保险基金拨款凭证'],
            ['id' => '6090', 'name' => '一般缴款书'],
            ['id' => '6999', 'name' => '印鉴书'],
            ['id' => '6087', 'name' => '财政资金支付凭证'],
            ['id' => '6073', 'name' => '内部通用凭证-附件'],

            ['id' => '6995', 'name' => '账户类-内部通用凭证'],
            ['id' => '6047', 'name' => '变更银行结算账户申请书'],
            ['id' => '8047', 'name' => '变更银行账户预留印鉴申请书'],
            ['id' => '6054', 'name' => '补（换）发开户许可证申请书'],
            ['id' => '6046', 'name' => '撤销银行结算账户申请书'],
            ['id' => '6045', 'name' => '单位结算账户开立调查书'],
            ['id' => '6064', 'name' => '开户许可证正本'],
            ['id' => '6065', 'name' => '开户许可证副本'],
            ['id' => '6036', 'name' => '开立单位银行结算账户申请书'],
            ['id' => '6041', 'name' => '已开立银行结算账户清单'],
            ['id' => '6060', 'name' => '营业执照'],
            ['id' => '6994', 'name' => '账户类资料'],
        ];
        return $data;
    }

    protected function rand($data, $total = 30)
    {
        $list = [];
        $length = count($data);
        for($i = 0; $i < $total; $i ++){
            $list[] = $data[rand(0, $length - 1)];
        }
        return $list;
    }

    public function index()
    {
        $data = $this->data();
        $list = $this->rand($data, 30);
        View::assign('list', $list);

        return View::fetch('bank/index');
    }

    public function switch()
    {
        $data = $this->data();

        $left_list = $this->rand($data, 30);
        $right_list = $this->rand($data, 30);

        View::assign('left_list', $left_list);
        View::assign('right_list', $right_list);

        return View::fetch('bank/switch');
    }


}
